package com.sugar.real.estate.module.business.dal.mysql.apartment;

import com.sugar.real.estate.framework.common.pojo.PageParam;
import com.sugar.real.estate.framework.common.pojo.PageResult;
import com.sugar.real.estate.framework.mybatis.core.mapper.BaseMapperX;
import com.sugar.real.estate.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.sugar.real.estate.module.business.dal.dataobject.apartment.ApartmentSalespersonDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 楼盘/公寓销售人员 Mapper
 *
 * @author Ysugar
 */
@Mapper
public interface ApartmentSalespersonMapper extends BaseMapperX<ApartmentSalespersonDO> {

    default PageResult<ApartmentSalespersonDO> selectPage(PageParam reqVO, Long apartmentId) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ApartmentSalespersonDO>()
            .eq(ApartmentSalespersonDO::getApartmentId, apartmentId)
            .orderByDesc(ApartmentSalespersonDO::getId));
    }

    default int deleteByApartmentId(Long apartmentId) {
        return delete(ApartmentSalespersonDO::getApartmentId, apartmentId);
    }

	default int deleteByApartmentIds(List<Long> apartmentIds) {
	    return deleteBatch(ApartmentSalespersonDO::getApartmentId, apartmentIds);
	}

}
